#include "uhm/common.hxx"
#include "uhm/util.hxx"
#include "uhm/discrete/base/mesh.hxx"

#define N 1

using namespace uhm;

typedef ID_Node_<N>             Id_Nd;
typedef ID_Element_<N>          Id_El;
typedef Mesh_<Id_Nd,Id_El,Int_> Mesh;

int main (int argc, char **argv) {

  Mesh::_Id_Nd_ nd;

  nd.set_id(0, 20); Mesh::Node_ node_a(nd);
  nd.set_id(0, 30); Mesh::Node_ node_b(nd);
  
  std::cout << node_a << "\n" 
            << node_b << "\n" 
            << " compare " << (node_a<node_b) << "\n" ;
  exchange<Mesh::Node_>(node_a, node_b);
  
  std::cout << node_a << "\n" 
            << node_b << "\n" 
            << " compare " << (node_a<node_b) << "\n" ;


  Mesh::_Id_El_ el;
  el.set_id(0, 100); Mesh::Element_ element_a(el);
  el.set_id(0, 200); Mesh::Element_ element_b(el);


  std::cout << element_a << "\n"
            << element_b << "\n"
            << " compare " << (element_a<element_b) << "\n" ;
  exchange<Mesh::Element_>(element_a, element_b);

  std::cout << element_a << "\n"
            << element_b << "\n"
            << " compare " << (element_a<element_b) << "\n" ;

  node_a.add_owner(&element_a);
  node_a.add_owner(&element_b);
  node_a.remove_owner(&element_a);  

  std::cout << node_a << "\n";

  node_b.add_owner(&element_a);
  node_b.set_kind(Mesh_Base_::NODE_BOUNDARY);
  node_b.set_marker(10);
  node_b.clean();

  
  std::cout << node_b << "\n";

  return true;
}


